import nprogress from '@logdna/nprogress'
import { AxiosRequestConfig } from 'axios'

/*
  拦截器名称：全局设置请求的 loading 动画
*/
const setLoading = (config: AxiosRequestConfig) => {
  if (config.url && (config.url.indexOf('page') > -1 || config.url === '/monitor/server/info')) {
    nprogress.start()
  }
  return config
}

export default setLoading
